//
//  ImageBrowserCollectionViewCell.m
//  WebImage
//
//  Created by 胡岩 on 16/2/24.
//  Copyright © 2016年 MagicalYan. All rights reserved.
//

#import "ImageBrowserCollectionViewCell.h"
#import <UIImageView+WebCache.h>

@interface ImageBrowserCollectionViewCell ()

@property (nonatomic, strong) UIScrollView *scrollView;
@property (nonatomic, strong) UIImageView *imageView;

@end

@implementation ImageBrowserCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        _imageView = [[UIImageView alloc] init];
        _scrollView = [[UIScrollView alloc] init];
        
        [self.contentView addSubview:_scrollView];
        [_scrollView addSubview:_imageView];
        
        _imageView.userInteractionEnabled = YES;
        UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(doubleTap:)];
        [_imageView addGestureRecognizer:doubleTap];
        
        UIPinchGestureRecognizer *pinch = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinchImageView:)];
        [_imageView addGestureRecognizer:pinch];
    }
    return self;
}

- (void)pinchImageView:(UIPinchGestureRecognizer *)gestureRecognizer {
    
}

- (void)doubleTap:(UITapGestureRecognizer *)gestureRecognizer {
    
}

- (void)layoutSubviews {
    [super layoutSubviews];
    _scrollView.frame = self.contentView.bounds;
    _scrollView.contentSize = CGSizeMake(self.contentView.frame.size.width, self.contentView.frame.size.height);
    _imageView.frame = self.contentView.bounds;
}

- (void)setImageUrl:(NSString *)imageUrl {
    [_imageView sd_setImageWithURL:[NSURL URLWithString:imageUrl]];
}















@end
